<!-- #include file="../DAL/BD.asp" -->
<!-- #include file="../BLL/DV.asp" -->

<%
	'conecto a la bdd
	set conexion=Conectar()


	dim consulta
	dim NumReg
'	consulta = "select * from DIGITOS_VERIFICADORES"
'	set rs = ConsultarBDD(consulta,conexion)
'       while not rs.EOF
	   		consulta = "select * from BITACORA"
            set rs2 = ConsultarBDD(consulta,conexion)
			NumReg=1
            while not rs2.EOF 
				dim tot,i
				tot=""
                For i = 0 To rs2.fields.count - 2
                    tot = tot & rs2.fields(i)
                Next
				response.Write(tot & "<br/>")
				response.Write(calcularDVH(tot) & rs2.fields("DVH") & "<br/>")
                If Not calcularDVH(tot) = rs2.fields("DVH") Then
				
				'	session("ErrorDVH")="Error Interno en la BDD, en la tabla " & rs.fields(1) & " en el registro numero " & NumReg & ". <br />Contacte a Soporte Tecnico"
                	'comprobarDVH = 0
				'	exit function
				response.Write("NO ok")& "<br/>"
				else
				response.Write("ok")& "<br/>"
					'comprobarDVH = 1
				End If
				NumReg=NumReg+1
				rs2.movenext 
            wend
'			rs.movenext 
'        wend
	
response.Write("<br/><br/>-----------------------------------------------------<br/><br/>")	

'	consulta = "select * from DIGITOS_VERIFICADORES"
'	set rs = ConsultarBDD(consulta,conexion)
'	while not rs.EOF 
		consulta = "select * from BITACORA"
		set rs2 = ConsultarBDD(consulta,conexion)
		while not rs2.EOF 
    '    	Dim tot,i,digito
			tot=""
            For i = 0 To rs2.fields.count - 2
            	tot = tot & rs2.fields(i)
            Next
			response.Write(tot) & "<br/>"
			digito=0
			digito = calcularDVH(tot)
			response.Write(digito) & "<br/>"
'			if rs.fields(1)="USUARIOS" then
'				consulta = "UPDATE " & rs.fields(1) & " set DVH=" & digito & " where id_Usuario=" & rs2.fields(0)
'			elseif rs.fields(1)="PRODUCTOS" then
'				consulta = "UPDATE " & rs.fields(1) & " set DVH=" & digito & " where id_Producto=" & rs2.fields(0)
'			elseif rs.fields(1)="BITACORA" then
'				consulta = "UPDATE " & rs.fields(1) & " set DVH=" & digito & " where id_Bitacora=" & rs2.fields(0)
'			end if
'			EjecutarConsulta consulta, conexion
			rs2.movenext
		wend
	'	rs.movenext
	'wend	
	
response.Write("<br/><br/>-----------------------------------------------------<br/><br/>")	


	'desconectar a la bdd
	Desconectar(conexion)
%>